<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>沙比</title>
		<script type="text/javascript" src="js/jquery-3.2.1.min.js" ></script>
		<style>
		
		</style>
	</head>
	<body>
		
		<p id="anniu" style="float: left;margin-left: 20px;font-size: 20px;">+</p>
		
		<input id="shuzi" style="float: left;margin-left: 20px;" value="0" readonly="readonly"></input>
		
		<p id="jian" style="float: left;margin-left: 20px;font-size: 28px;">-</b>
			<p id="zongjie"></p>
		<script>
			var anniu= document.getElementById("anniu");
			var shuzi=document.getElementById("shuzi");
			var jian=document.getElementById("jian");
			var zongjie=document.getElementById("zongjie");	
				
			anniu.onclick=function(){
				shuzi.value=parseInt(shuzi.value)+1;
				zongjie.innerHTML=2*shuzi.value;
			};
			
			jian.onclick=function(){
				shuzi.value=parseInt(shuzi.value)-1;
				
				if(shuzi.value<=0){
				shuzi.value=0;
			}
				zongjie.innerHTML=2*shuzi.value;
			};
			
		</script>
		
	</body>
</html>
